{% extends 'wiki/base.html' %}

{% set page_title = _('Latest Changes') %}
{% set feed_link = url_for('wiki/changes-atom') %}

{% block title %}{{ page_title }} - {{ sitename }}{% endblock %}

{%- block extrahead -%}
    {{- super() -}}
    <link type="application/atom+xml" rel="alternate" href="{{ feed_link }}" title="{{ _('Atom feed for this page') }}">
{% endblock %}

{% block content %}
    <h1>
        {{ page_title }}
        <ul class="actions">
            <li><span class="icon icon-feed"></span> <a href="{{ feed_link }}" title="{{ _('Atom feed for this page') }}">{{ _('Feed') }}</a></li>
        </ul>
    </h1>
    {% if pages %}
    <p>{{ _('Here are the latest pages changed in this wiki.') }}</p>
    <table class="grid" id="wiki-changes">
        <tbody>
        {% set row_class = cycler('odd', 'even') %}
        {% for page in pages %}
            <tr class="{{ row_class.next() }}">
                <td>
                    <span class="icon icon-page"></span> <a href="{{ url_for('wiki/index', page_path=page.path) }}">{{ page.path }}</a>
                </td>
                <td class="page-date">
                    <span class="icon icon-alarm"></span> <time pubdate="pubdate" datetime="{{ format_datetime(page.updated, 'iso') }}">{{ format_datetime(page.updated, 'medium') }}</time>
                </td>
                <td class="page-history">
                    <span class="icon icon-wait"></span> <a href="{{ url_for('wiki/changes', page_path=page.path) }}" title="{{ _('Change history for this page') }}">{{ _('History') }}</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
        {% if not is_first_page or next_page %}
        <tfoot>
            <tr>
                <td colspan="3">
                    {% if not is_first_page %}
                        &larr; <a href="javascript:history.back();">{{ _('previous page') }}</a>
                    {% endif %}
                    {% if not is_first_page and next_page %} | {% endif %}
                    {% if next_page %}
                        <a href="{{ url_for('wiki/changes', start=next_page) }}">{{ _('next page') }}</a> &rarr;
                    {% endif %}
                </td>
            </tr>
        </foot>
        {% endif %}
    </table>
    {% else %}
        <p>{{ _('Weird, no changes were found.') }}</p>
    {% endif %}
{% endblock %}
